package com.xkcoding.helloworld.strategy.enumWay;

import cn.hutool.core.util.ObjectUtil;

public enum DiscountEnum {
    strategyA("discountA", "discountAServiceImpl"),
    strategyB("discountB", "discountBServiceImpl"),
    strategyC("discountC", "discountCServiceImpl"),
    strategyD("discountD", "discountDServiceImpl"),
    ;

    private String name;
    private String discountImplName;

    public static String getDiscountImplName(String name) {
        if (ObjectUtil.isEmpty(name)) {
            return null;
        }

        for (DiscountEnum aEnum : DiscountEnum.values()) {
            if (aEnum.getName().equals(name)) {
                return aEnum.getDiscountImplName();
            }
        }
        return null;
    }

    DiscountEnum(String name, String discountImplName) {
        this.name = name;
        this.discountImplName = discountImplName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDiscountImplName() {
        return discountImplName;
    }

    public void setDiscountImplName(String discountImplName) {
        this.discountImplName = discountImplName;
    }
}
